package ru.st.selenium.pages;

import static org.openqa.selenium.support.ui.ExpectedConditions.presenceOfElementLocated;

import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;

public class AddNewFilmPage extends AnyPage{

	public AddNewFilmPage(PageManager pages) {
		super(pages);
		
	}
  @FindBy(name="name")
  private WebElement nameFilmField;

  @FindBy(name="year")
  private WebElement yearFilmField;
  
  @FindBy(name="notes")
  private WebElement notesForFilmField;

  @FindBy(name="submit")
  private WebElement submitButton;

  
 
public void clickSubmitButton() {
	submitButton.click();
}


public AddNewFilmPage setNameFilmField(String text) {
	nameFilmField.sendKeys(text);
	return this;
	}

public AddNewFilmPage setYearFilmField(String text) {
	yearFilmField.sendKeys(text);
	return this;

}

  
public AddNewFilmPage setNotesForFilmField(String text) {
	notesForFilmField.sendKeys(text);;
	return this;
	
}
public AddNewFilmPage ensurePageLoaded() {
    super.ensurePageLoaded();
    wait.until(presenceOfElementLocated(By.cssSelector("div.addmovie")));
    return this;
  }


}

